package main

import (
	"fmt"
	"time"
)

func main() {
	/*
		临界资源：指并发环境中多个进程/线程/协程共享的资源
	*/
	a := 1 //a就是一个临界资源，被主goroutine和子goroutine都使用
	go func() {
		a = 2
		fmt.Println("goroutine中...", a)
	}()

	a = 3
	time.Sleep(1)
	fmt.Println("main goroutine...", a)
}
